/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package beans.util;

import java.util.List;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;

/**
 *
 * @author marcy
 */
public class WholePatientListBean {

    private List<Object[]> lista;
    private int page = 1;

    public WholePatientListBean() {
        if (lista == null) {
            EntityManagerFactory emf = Persistence.createEntityManagerFactory("PortaleVisitePU");
            EntityManager em = emf.createEntityManager();
            lista = (List<Object[]>) em.createNativeQuery("Select P.nome, P.cognome, P.data_nascita, M.nome, M.cognome, P.maschio "
                    + "From Patient P, Medic M, Referenze R "
                    + "Where P.id = R.id_paz "
                    + "and M.id = P.id_med;").getResultList();
        }

    }

    public int getPage() {
        return page;
    }

    public void setPage(int page) {
        this.page = page;
    }
    
    
    public List<Object[]> getLista() {

        return lista;
    }

    public void setLista(List<Object[]> lista) {
        this.lista = lista;
    }
}
